import { defineComponent, h } from 'vue'
import startImage from '../../resource/assets/start_page.jpg'
import btnImage from '../../resource/assets/startBtn.png'

export default defineComponent({
  setup(props,ctx) {
    const handlClick = function  () {
      console.log('点击了');
      // 触发父组件的事件
      ctx.emit('changePage', 'gamePage')      
    }
    return {
      handlClick
    }
  },
  render(ctx) {
    return h('Container', [
      h('Sprite', {texture: startImage }),
      h('Sprite', { texture: btnImage, 
        x: 210, 
        y: 400, 
        interactive: true,
        onClick: ctx.handlClick
      })
    ])
  }
})